"""
post请求
"""

import requests
import json

# 1 get请求的参数名是params，post请求的参数名是data
# 2 请求路径后面可以不加“问号”
# 3 不需要手动编解码
# 4 不需要做请求对象的定制


url = "https://fanyi.baidu.com/sug"

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
}

data = {"kw": "hello"}

# 使用代理
proxy = {"http": "125.87.92.229.22584"}

response = requests.post(url=url, data=data, headers=headers, proxies=proxy)
content = response.text
obj = json.loads(content)
print(obj)
